<template>
    <div class="body_background" :style="GetWindowBackground">
        <div class="body_background marBottom">
            <ul class="order-list-box">
                <li>
                    <router-link to="/StockInventoryDetail?id=1&name='张三'">
                        <div class="order-top-box second-color big-font-size">
                            <div>
                                <span class="main-color">盘点名称：</span>
                                <span class="three-color">九月盘点</span>
                            </div>
                            <div class="main-color">待盘点</div>
                        </div>
                        <div class="order-content-box" v-for="(item,index) in goodsList" :key="item.id">
                            <img :src="item.imgUrl"/>
                            <div class="order-info-box">
                                <div class="main-color big-font-size">商品名称</div>
                                <div class="goods-content">
                                    <div>
                                        <div class="three-color small-font-size">分类：蔬菜</div>
                                        <div class="three-color small-font-size">规格：200g</div>
                                        <div class="three-color small-font-size">库存：200袋</div>
                                    </div>
                                    <div class="light-color small-font-size goods-count">
                                        <span>货值:</span>
                                        <span class="font-size16 main-color">￥2020</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </router-link>
                    <div class="small-font-size main-color order-item-price">
                        <div>
                            盘点结果：盘亏/盘盈（
                            <span class="price-color">-￥500</span>/
                            <span class="green-color">+￥500</span>）
                        </div>
                        <div>共3件商品</div>
                    </div>
                    <div class="order-operation-box">
                        <div class="small-font-size main-color">计划编号：4545</div>
                        <!--待盘点显示--开始-->
                        <div class="order-operation-button">
                            <mt-button plain type="primary"
                                       size="small"
                                       @click.native="cancelClickFun"
                                       class="green-color green-border"
                            >撤销</mt-button>
                            <mt-button plain type="primary"
                                       size="small"
                                       @click.native="goInventoryFun"
                                       class="background white-color green-border"
                            >盘点</mt-button>
                        </div>
                        <!--待盘点显示--结束-->
                    </div>
                </li>
            </ul>
            <div class="seize-seat light-color">-- 没有数据了 --</div>
        </div>
        <div class="body_background create-button-box">
            <mt-button class="background white-color middle-font-size create-button"
                       @click="createInventoryFun"
            >创建盘点计划
            </mt-button>
        </div>
    </div>
</template>

<script>
    import {Toast} from 'mint-ui';

    export default {
        name: "StockInventoryList",
        data() {
            return {
                GetWindowBackground: {
                    'min-height': ''
                },
                goodsList: [
                    {
                        id: 1,
                        title: "秘制小番茄500g",
                        spec: '500g/袋',
                        weight: '500g',
                        warehouse: '常温',
                        num: 0,
                        imgUrl:
                            "https://t00img-c.yangkeduo.com/goods/images/2020-08-13/ce99a1b2f665ba478d9573c314686c5d.jpeg"
                    }
                ],
            }
        },
        mounted() {

        },
        methods: {

            //盘点
            goInventoryFun(id){
                Toast('盘点');
                this.$router.push('/StockInventorySub')
            },

            //撤销
            cancelClickFun() {
                Toast('取消');
            },
            //创建
            createInventoryFun(){
                this.$router.push('/StockInventoryCreate')
            },

            getHeight() {
                // 获取浏览器高度
                this.GetWindowBackground['min-height'] = window.innerHeight + 'px'
            },
        },
        // 生命周期 - 创建完成（可以访问当前this实例）
        created() {
            window.addEventListener('resize', this.getHeight) // 注册监听器
            this.getHeight() // 页面创建时先调用一次
        },
        // 生命周期 - 销毁完成
        destroyed() {
            window.removeEventListener('resize', this.getHeight)
        },
    }
</script>

<style lang="scss" scoped>
    .top-nav-box {
        width: 100%;
        height: 40px;
        overflow-x: auto;
        display: flex;
        padding-top: 5px;
        background: #fff;
        li {
            width: 25%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            font-size: 15px;
        }
        .no_active {
            width: 15px;
            height: 2px;
            margin-top: 3px;
            background: #fff;
        }
        .active {
            width: 15px;
            height: 2px;
            margin-top: 3px;
            background: #05c569;
        }
    }

    .order-list-box {
        width: calc(100% - 20px);
        height: auto;
        margin: 10px 10px 0 10px;
        li {
            width: calc(100% - 30px);
            background: #fff;
            padding: 0 15px;
            margin-bottom: 10px;
            border-radius: 4px;
            .type {
                width: 100%;
                text-align: left;
                padding-bottom: 5px;
            }
            .order-top-box {
                width: 100%;
                height: 35px;
                display: flex;
                justify-content: space-between;
                align-items: center;
            }
            .order-content-box {
                width: 100%;
                display: flex;
                padding: 7px 0;
                img {
                    width: 70px;
                    height: 70px;
                    margin-right: 10px;
                    border-radius: 4px;
                }
                .goods-content{
                    width: 100%;
                    display: flex;
                    justify-content: space-between;
                }
                .order-info-box {
                    width: calc(100% - 70px);
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                    text-align: left;
                }
                .goods-count {
                    margin-left: auto;
                    margin-top: 10px;
                }
            }
            .order-operation-box {
                width: 100%;
                min-height: 40px;
                display: flex;
                align-items: center;
                justify-content: space-between;
                border-top: 1px dashed #D2D6DC;
                padding: 5px 0;
            }
            .order-item-price {
                width: 100%;
                display: flex;
                justify-content: space-between ;
                margin: 10px 0 15px 0;
            }

        }
    }

    .create-button-box {
        width: 100%;
        height: 70px;
        position: fixed;
        bottom: 0px;

        .create-button {
            width: 200px;
            margin-top: 15px;
            border-radius: 10px;
        }
    }

    .mint-button--small {
        display: inline-block;
        padding: 0 10px;
        height: 26px;
        margin-left: 10px;
    }
</style>